#!/usr/bin/env python
# coding=utf-8
# 15/3/29 18:08 zhuxuehuang

import time, thread


def func():
    for i in range(5):
        print('func')
        time.sleep(1)

    thread.exit()


thread.start_new(func, ())

lock = thread.allocate()
print(lock.locked)

count = 0

if lock.acquire():
    count += 1

    lock.release()

time.sleep(6)

print(count)